﻿using Andy.Web.SanPhamServiceReference;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Andy.Web.admin
{
    public partial class ht_qllsp : VdcInc.vdcAJAXPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                loadGrid();
            }
        }
        public void loadGrid()
        {
            using (var ndService = new SanPhamServiceReference.SanPhamServiceClient())
            {
                var lstLSP = ndService.DanhSachLoaiSanPham();
                grid1.DataSource = lstLSP;
                grid1.DataBind();
            }
        }
        public string vXoaSanPham(string strSanPhamId)
        {
            using (var spService = new SanPhamServiceReference.SanPhamServiceClient())
            {
                if (!string.IsNullOrEmpty(strSanPhamId))
                {
                    var sp = new LoaiSanPham();
                    sp.Id = Convert.ToInt64(strSanPhamId);
                    var result = spService.CapNhatLoaiSanPham(sp);
                    return "Xóa " + result;
                }
                return "Xóa thất bại";
            }
        }
    }
}